package com.ss.android.article.base.feature.subscribe.activity;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import com.ss.android.article.base.feature.search.a;
import com.ss.android.article.browser.R;
import com.ss.android.common.lib.MobClickCombiner;
import com.ss.android.newmedia.a.BrowserFragment;

public class j extends a {
    private FrameLayout p;
    private BrowserFragment q;

    public j() {

    }

    public final void a(String arg2, boolean arg3) {
        super.a(arg2, arg3);
        if(android.support.design.a.isTextEmpty(arg2)) {
            arg2 = this.c.getText().toString().trim();
        }

        if(arg2.length() > 0) {
            this.l = arg2;
            this.l();
        }
    }

    public final int b() {
        return R.layout.hc;
    }

    public final void b(String arg4) {
        String v0 = "sub_search_tab";
        if("clear_input".equals(arg4)) {
            MobClickCombiner.onEvent(this.a, v0, "cancel_search");
        }
    }

    public final int c() {
        return 2;
    }

    public final void d(String arg3) {
        String v0 = null;
        if(!"clear_history".equals(arg3)) {
            arg3 = "delete_history".equals(arg3) ? "clear_one" : v0;
        }

        if(arg3 != null) {
            MobClickCombiner.onEvent(this.getActivity(), "sub_search_tab", arg3);
        }
    }

    public final void e() {
        super.e();
        if(android.support.design.a.isTextEmpty(this.c.getText().toString())) {
            this.l = "";
            this.p.setVisibility(View.GONE);
            this.f.setVisibility(View.INVISIBLE);
        }
        else {
            this.f.setVisibility(View.VISIBLE);
        }
    }

    public final void f() {
        super.f();
        if(!android.support.design.a.isTextEmpty(this.g)) {
            this.l();
        }
    }

    public final void h() {
        super.h();
        this.g = null;
        this.h = "media";
    }

    public final void l() {
        super.l();
        if(this.p != null) {
            this.p.setVisibility(View.VISIBLE);
            String v0 = this.a();
            if(this.q == null) {
                this.q = this.m();
                Bundle v1 = new Bundle();
                v1.putString("bundle_url", v0);
                v1.putString("key_words", this.l);
                this.setUserVisibleHint(false);
                this.q.setArguments(v1);
                this.getFragmentManager().beginTransaction().replace(com.ss.android.article.browser.R.id.a7o, this.q, "pgc_search_webview").commitAllowingStateLoss();
            }

            this.q.a(v0, true);
        }
    }

    public void onActivityCreated(Bundle arg1) {
        super.onActivityCreated(arg1);
        this.e();
    }

    public View onCreateView(LayoutInflater arg3, ViewGroup arg4, Bundle arg5) {
        View v1 = super.onCreateView(arg3, arg4, arg5);
        this.p = v1.findViewById(com.ss.android.article.browser.R.id.a7o);
        return v1;
    }

    public void onResume() {
        super.onResume();
    }
}

